package org.grapes.wine.api.server.persistence;

import org.grapes.wine.api.server.startup.InitSessionFactory;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

@Deprecated
public class HibernateUtil {
	private static final SessionFactory sessionFactory;
	static {
		sessionFactory = InitSessionFactory.getInstance();
	}
	
	@Deprecated
	public static Session currentSession() throws HibernateException {
		Session session = sessionFactory.openSession();
		return session;
	}

	@Deprecated
	public static void closeSession(Session session) {
		if (session != null)
			session.close();
	}
}